import random
def Guess(n):
    guess = int(input("你还有{}次机会，请输入你猜的数字[0-1000]：".format(n)))
    if guess < number:
        print("太小了，再大一点！")
        n -= 1
    elif guess > number:
        print("太大了，再小一点！")
        n -= 1
    else:
        print("恭喜你猜对了")
        return
    if n == 0:
        print("太笨了。下次再来吧")
    else:
        return Guess(n)


if __name__ == '__main__':
    number = random.randint(0, 1000)  # 在0 - 1000 间产生随机整数
    n = 10  # 用户猜的次数
    Guess(10)
